<?php
class Config_code extends CI_Controller {
	
	/**
	 * @author tien.nguyen
	 * @param unknown_type $configCode
	 */
	public function edit($configCode){
		$this->load->model('Configs', null, true);		
		$config = $this->Configs->getConfigByConfigCode(strtoupper($configCode));
		if($this->input->post()){
			$data = $this->input->post();	
			if($this->Configs->edit($data, $config['ConfigId'])){
				$this->session->set_flashdata('message', 'Lưu thành công');                
				$config['ConfigValue'] = $data['ConfigValue'];
			}else{
				$this->session->set_flashdata('message', 'Lưu có lỗi');
			}
		}
		
		$data['config'] = $config;
		$this->load->view('config_code/edit', $data);
	}
}